<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="inc/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <%@ include file="inc/meta.jsp" %>
    <meta name="description" content="">
    <meta name="author" content="">
    <title>评论详情</title>
    <%@ include file="inc/css.jsp" %>
</head>
<body>

<div id="posts" class="wrapper">

    <%@ include file="inc/nav.jsp" %>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">微音列表</h1>
                <h4 style="margin-left: 10px;">——评论详情</h4>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <form class="form-horizontal">
                            <input type="hidden" id="tempCommentSourceId" value="${sourceId}"/>
                            <input type="hidden" id="tempCommentType" value="${type}"/>

                            <c:if test="${null != comment.user}">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">评论人头像:</label>

                                    <div class="col-sm-4" style="padding-top: 6.5px;">
                                        <img src="${comment.user.avatar}" height="120px" width="120px"/>
                                    </div>
                                </div>
                            </c:if>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">评论人昵称:</label>

                                <div class="col-sm-4" style="padding-top: 6.5px;">
                                    <c:if test="${null != comment.user}">
                                        ${comment.user.nickName}
                                    </c:if>
                                    <c:if test="${null == comment.user}">
                                        管理员
                                    </c:if>
                                </div>
                            </div>

                            <c:if test="${null != comment.user && null != comment.user.region}">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">评论人所在地:</label>

                                    <div class="col-sm-4" style="padding-top: 6.5px;">
                                            ${comment.user.region.city.province.name}${comment.user.region.city.name}
                                    </div>
                                </div>
                            </c:if>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">评论时间:</label>

                                <div class="col-sm-4" style="padding-top: 6.5px;">
                                    ${createTime}
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">评论类型:</label>

                                <div class="col-sm-4" style="padding-top: 6.5px;">
                                    <c:if test="${'' != comment.content && comment.voiceTime > 0 && comment.imageList.size() > 0}">
                                        文字图片语音
                                    </c:if>
                                    <c:if test="${'' == comment.content && comment.voiceTime > 0 && comment.imageList.size() > 0}">
                                        图片语音
                                    </c:if>
                                    <c:if test="${'' != comment.content && comment.voiceTime == 0 && comment.imageList.size() > 0}">
                                        文字图片
                                    </c:if>
                                    <c:if test="${'' != comment.content && comment.voiceTime > 0 && comment.imageList.size() == 0}">
                                        文字语音
                                    </c:if>
                                    <c:if test="${'' != comment.content && comment.voiceTime == 0 && comment.imageList.size() == 0}">
                                        文字
                                    </c:if>
                                    <c:if test="${'' == comment.content && comment.voiceTime == 0 && comment.imageList.size() > 0}">
                                        图片
                                    </c:if>
                                    <c:if test="${'' == comment.content && comment.voiceTime > 0 && comment.imageList.size() == 0}">
                                        语音
                                    </c:if>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">评论内容:</label>

                                <div class="col-sm-6" style="padding-top: 6.5px;">
                                    ${comment.content}
                                </div>
                            </div>

                            <c:if test="${comment.voiceTime > 0}">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">评论语音:</label>

                                    <div class="col-sm-6" style="padding-top: 6.5px;">
                                        <audio controls="controls">
                                            <source src="${comment.voiceUrl}" type="audio/mpeg">
                                        </audio>
                                    </div>
                                </div>
                            </c:if>

                            <c:if test="${comment.imageList.size() > 0}">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">评论图片:</label>

                                    <div class="col-sm-9" style="padding-top: 6.5px;">
                                        <c:forEach var="n" items="${comment.imageList}">
                                            <img src="${n.url}" height="200px" width="200px" style="margin: 3px;border: 1px solid #000000"/>
                                        </c:forEach>
                                    </div>
                                </div>
                            </c:if>

                            <div class="form-group">
                                <div class="col-sm-12" style="text-align: center">
                                    <a href="javascript:void(0)" onclick="commentGoBack()" class="btn btn-primary" role="button">返回</a>
                                </div>
                            </div>
                        </form>
                    </div>
                    <!-- /.panel-body -->

                </div>
            </div>
        </div>

    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->

<%@ include file="inc/footer.jsp" %>

</body>

<script type="text/javascript">
    function commentGoBack() {
        var sourceId = $('#tempCommentSourceId').val();

        if (null == sourceId || sourceId == '') {
            window.location.href = 'backend/broadcast/index';
        } else {
            window.location.href = 'backend/broadcast/add?broadcastId=' + sourceId;
        }
    }
</script>

</html>